<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 86.71%
    var transpose = function(A) {
        const row = A.length;
        const col = A[0].length;
        let res = [];
        for(let i=0; i<col; i++){
            let arr = [];
            for(let j=0; j<row; j++){
                arr.push(A[j][i]);
            }
            res.push(arr);
        }
        return res;
    };
    let A = [
        [1,2,3],
        [4,5,6],
        [7,8,9]
    ];
    console.log(transpose(A));
    
</script>
</html>